package com.aspose.cells;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

class zuf {
   private Workbook b;
   private Worksheet c;
   private Cells d;
   private RowCollection e;
   private zol f;
   private zof g;
   private HashMap h;
   private boolean i;
   private ArrayList j;
   private OoxmlSaveOptions k;
   private String l = "";
   zty a = null;
   private int m = 0;

   zuf(zol var1, zof var2, OoxmlSaveOptions var3) {
      this.f = var1;
      this.b = var1.b;
      this.c = var1.a;
      this.d = this.c.getCells();
      this.e = this.d.getRows();
      this.g = var2;
      if (this.d.b((short)0) > 0) {
         this.h = new HashMap(this.d.b((short)0));
      } else {
         this.h = new HashMap();
      }

      this.k = var3;
      this.i = var3.getExportCellName();
      this.j = new ArrayList();
   }

   void a(zcfx var1) throws Exception {
      var1.b(true);
      var1.b("worksheet");
      this.f(var1);
      this.o(var1);
      this.q(var1);
      this.r(var1);
      this.u(var1);
      this.v(var1);
      this.t(var1);
      this.n(var1);
      this.m(var1);
      this.c(var1);
      if (this.c.hasAutofilter()) {
         a(var1, this.c.getAutoFilter(), true);
      }

      this.g(var1);
      this.s(var1);
      this.x(var1);
      this.p(var1);
      this.w(var1);
      this.b(var1, this.c.getPageSetup());
      this.a(var1, this.c.getPageSetup());
      this.a(var1, this.c.getPageSetup(), this.f.s);
      this.c(var1, this.c.getPageSetup());
      a(var1, this.c.getHorizontalPageBreaks());
      a(var1, this.c.getVerticalPageBreaks());
      this.e(var1);
      this.h(var1);
      this.d(var1);
      if (this.f.m.a != null) {
         var1.b("drawing");
         var1.a("r:id", (String)null, this.f.m.a);
         var1.b();
      }

      if (this.f.n.a != null) {
         var1.b("legacyDrawing");
         var1.a("r:id", (String)null, this.f.n.a);
         var1.b();
      }

      if (this.f.l.a != null) {
         var1.b("legacyDrawingHF");
         var1.a("r:id", (String)null, this.f.l.a);
         var1.b();
      }

      if (this.f.r != null) {
         var1.b("picture");
         var1.a("r:id", (String)null, this.f.r);
         var1.b();
      }

      this.j(var1);
      this.k(var1);
      this.l(var1);
      this.i(var1);
      this.a(var1, this);
      var1.b();
      var1.d();
      var1.e();
   }

   private void c(zcfx var1) throws Exception {
      if (this.c.o != null && this.c.o.getCount() != 0) {
         ScenarioCollection var2 = this.c.o;
         var1.b("scenarios");
         var1.a("current", zase.y(var2.b));
         var1.a("show", zase.y(var2.c));
         if (var2.d != null && var2.d.size() > 0) {
            String var3 = zase.b(var2.d, 0, var2.d.size() - 1);
            var1.a("sqref", var3);
         }

         for(int var7 = 0; var7 < var2.getCount(); ++var7) {
            Scenario var4 = this.c.o.get(var7);
            var1.b("scenario");
            var1.a("name", var4.b);
            if (var4.isLocked()) {
               var1.a("locked", var4.isLocked() ? "1" : "0");
            }

            var1.a("count", zase.y(var4.getInputCells().getCount()));
            var1.a("user", var4.getUser());
            var1.a("comment", var4.getComment());
            if (var4.isHidden()) {
               var1.a("hidden", var4.isHidden() ? "1" : "0");
            }

            for(int var5 = 0; var5 < var4.getInputCells().getCount(); ++var5) {
               ScenarioInputCell var6 = var4.getInputCells().get(var5);
               var1.b("inputCells");
               var1.a("r", var6.getName());
               var1.a("val", var6.c);
               if (var6.d != 0) {
                  var1.a("numFmtId", zase.y(var6.d));
               }

               if (var6.e) {
                  var1.a("deleted", var6.e ? "1" : "0");
               }

               if (var6.f) {
                  var1.a("undone", var6.f ? "1" : "0");
               }

               var1.b();
            }

            var1.b();
         }

         var1.b();
      }
   }

   private void d(zcfx var1) throws Exception {
      ErrorCheckOptionCollection var2 = this.c.i;
      if (var2 != null && var2.getCount() != 0) {
         boolean var3 = false;

         int var4;
         ErrorCheckOption var5;
         for(var4 = 0; var4 < var2.getCount(); ++var4) {
            var5 = var2.get(var4);
            if (var5.a != null && var5.a.size() != 0) {
               var3 = true;
               break;
            }
         }

         if (var3) {
            var1.b("ignoredErrors");

            for(var4 = 0; var4 < var2.getCount(); ++var4) {
               var5 = var2.get(var4);
               if (var5.a != null && var5.a.size() != 0) {
                  var1.b("ignoredError");
                  var1.a("sqref", zase.b(var5.a, 0, var5.a.size()));
                  if (!var5.isErrorCheck(1)) {
                     var1.a("evalError", "1");
                  }

                  if (!var5.isErrorCheck(32)) {
                     var1.a("twoDigitTextYear", "1");
                  }

                  if (!var5.isErrorCheck(4)) {
                     var1.a("numberStoredAsText", "1");
                  }

                  if (!var5.isErrorCheck(16)) {
                     var1.a("formula", "1");
                  }

                  if (!var5.isErrorCheck(8)) {
                     var1.a("formulaRange", "1");
                  }

                  if (!var5.isErrorCheck(64)) {
                     var1.a("unlockedFormula", "1");
                  }

                  if (!var5.isErrorCheck(2)) {
                     var1.a("emptyCellReference", "1");
                  }

                  if (!var5.isErrorCheck(128)) {
                     var1.a("listDataValidation", "1");
                  }

                  if (!var5.isErrorCheck(129)) {
                     var1.a("calculatedColumn", "1");
                  }

                  var1.b();
               }
            }

            var1.b();
         }
      }
   }

   private void e(zcfx var1) throws Exception {
      SmartTagSetting var2 = this.c.C();
      if (var2 != null && var2.getCount() != 0) {
         var1.b("smartTags");

         for(int var3 = 0; var3 < var2.getCount(); ++var3) {
            SmartTagCollection var4 = var2.get(var3);
            var1.b("cellSmartTags");
            var1.a("r", CellsHelper.cellIndexToName(var4.getRow(), var4.getColumn()));

            for(int var5 = 0; var5 < var4.getCount(); ++var5) {
               SmartTag var6 = var4.get(var5);
               boolean var7 = false;
               if (var6.b() != null) {
                  int var10 = this.b.getWorksheets().aa().a(var6.b());
                  if (var10 >= 0) {
                     var1.b("cellSmartTag");
                     var1.a("type", zase.y(var10));
                     if (var6.getDeleted()) {
                        var1.a("deleted", "1");
                     }

                     if (var6.a()) {
                        var1.a("xmlBased", "1");
                     }

                     for(int var8 = 0; var8 < var6.getProperties().getCount(); ++var8) {
                        SmartTagProperty var9 = var6.getProperties().get(var8);
                        var1.b("cellSmartTagPr");
                        var1.a("key", var9.getName());
                        var1.a("val", var9.getValue());
                        var1.b();
                     }

                     var1.b();
                  }
               }
            }

            var1.b();
         }

         var1.b();
      }
   }

   private void f(zcfx var1) throws Exception {
      if (zase.a) {
         var1.a("xmlns", zase.c);
      } else {
         var1.a("xmlns", zase.d);
      }

      var1.a("xmlns", "r", (String)null, "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
      var1.a("xmlns", "xdr", (String)null, "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
      var1.a("xmlns", "x14", (String)null, "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
      var1.a("xmlns", "mc", (String)null, "http://schemas.openxmlformats.org/markup-compatibility/2006");
      if (this.c.g != null && this.c.g.g.size() > 0) {
         Iterator var2 = this.c.g.g.iterator();

         while(var2.hasNext()) {
            Object var3 = var2.next();
            znm var4 = (znm)var3;
            var1.a(var4.a, var4.b);
         }
      }

   }

   private void a(zcfx var1, zuf var2) throws Exception {
      zug var3 = new zug(this.f);
      var3.a(var1, var2);
   }

   private void g(zcfx var1) throws Exception {
      if (this.c.n != null && this.c.n.getCount() != 0) {
         var1.b("customSheetViews");

         for(int var2 = 0; var2 < this.c.n.getCount(); ++var2) {
            znb var3 = this.c.n.a(var2);
            var1.b("customSheetView");
            a(var1, var3);
            this.a(var1, zqh.b(var3));
            a(var1, var3.k);
            a(var1, var3.l);
            this.a(var1, var3.e());
            this.b(var1, var3.e());
            this.a(var1, var3.e(), var3.b);
            this.c(var1, var3.e());
            if (var3.a() > 0) {
               a(var1, var3.b(), false);
            }

            var1.b();
         }

         var1.b();
      }

   }

   private static void a(zcfx var0, znb var1) throws Exception {
      int var2 = var1.I();
      if (var2 < 64) {
         var0.a("colorId", zase.y(var2));
      }

      var0.a("guid", "{" + com.aspose.cells.b.a.zr.a(var1.n) + "}");
      if (var1.p()) {
         var0.a("filter", "1");
      }

      if (var1.q()) {
         var0.a("filterUnique", "1");
      }

      if (!var1.e().isPercentScale()) {
         var0.a("fitToPage", "1");
      }

      if (var1.l()) {
         var0.a("hiddenColumns", "1");
      }

      if (var1.k()) {
         var0.a("hiddenRows", "1");
      }

      if (!var1.B()) {
         var0.a("outlineSymbols", "0");
      }

      if (var1.r()) {
         var0.a("printArea", "1");
      }

      if (var1.D() != 100) {
         var0.a("scale", zase.y(var1.D()));
      }

      if (var1.o()) {
         var0.a("showAutoFilter", "1");
      }

      if (var1.v()) {
         var0.a("showFormulas", "1");
      }

      if (!var1.w()) {
         var0.a("showGridLines", "0");
      }

      if (var1.n()) {
         var0.a("showPageBreaks", "1");
      }

      if (!var1.x()) {
         var0.a("showRowCol", "0");
      }

      if (var1.E() == 2 && !var1.G()) {
         var0.a("showRuler", "0");
      }

      String var3;
      if (var1.F() != 0) {
         var3 = "hidden";
         if (var1.F() == 2) {
            var3 = "veryHidden";
         }

         var0.a("state", var3);
      }

      var3 = CellsHelper.columnIndexToName(var1.j()) + zase.y(var1.i() + 1);
      var0.a("topLeftCell", var3);
      String var4 = zase.aq(var1.E());
      if (var4 != null) {
         var0.a("view", var4);
      }

      if (!var1.A()) {
         var0.a("showZeros", "0");
      }

   }

   private void h(zcfx var1) throws Exception {
      int var2 = this.f.u.size();
      if (var2 != 0) {
         var1.b("customProperties");

         for(int var3 = 0; var3 < var2; ++var3) {
            zoe var4 = (zoe)this.f.u.get(var3);
            var1.b("customPr");
            var1.a("name", var4.a);
            var1.a("r:id", (String)null, var4.b);
            var1.b();
         }

         var1.b();
      }
   }

   private void i(zcfx var1) throws Exception {
      if (this.f.v.size() != 0) {
         var1.b("tableParts");
         Iterator var2 = this.f.v.values().iterator();

         while(var2.hasNext()) {
            String var3 = (String)var2.next();
            var1.b("tablePart");
            var1.a("r:id", (String)null, var3);
            var1.b();
         }

         var1.b();
      }
   }

   private void j(zcfx var1) throws Exception {
      ArrayList var2 = this.f.o;
      int var3 = var2.size();
      if (var3 != 0) {
         var1.b("oleObjects");

         for(int var4 = 0; var4 < var3; ++var4) {
            zob var5 = (zob)var2.get(var4);
            var1.d("<mc:AlternateContent xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\">");
            var1.d("<mc:Choice Requires=\"x14\">");
            this.a(var1, var5, true, var5.b);
            var1.d("</mc:Choice>");
            var1.d("<mc:Fallback>");
            this.a(var1, var5, false, var5.b);
            var1.d("</mc:Fallback>");
            var1.d("</mc:AlternateContent>");
         }

         var1.b();
      }
   }

   private void a(zcfx var1, zob var2, boolean var3, String var4) throws Exception {
      var1.b("oleObject");
      if (var2.a.getProgID() != null) {
         var1.a("progId", var2.a.getProgID());
      }

      if (var2.a.getDisplayAsIcon()) {
         var1.a("dvAspect", "DVASPECT_ICON");
      }

      if (var2.a.isLink()) {
         var1.a("link", var2.a.p());
         if (var2.a.r()) {
            var1.a("oleUpdate", "OLEUPDATE_ALWAYS");
         }
      }

      if (var2.b != null) {
         var1.a("shapeId", var4);
      }

      if (var2.c != null) {
         var1.a("r:id", (String)null, var2.c);
      }

      if (var3) {
         var1.b("objectPr");
         var1.a("defaultSize", "0");
         if (var2.d == null) {
            var1.a("autoPict", "0");
         } else {
            var1.a("r:id", var2.d);
         }

         this.a(var1, (Shape)var2.a);
         var1.b();
      }

      var1.b();
   }

   private void k(zcfx var1) throws Exception {
      if (this.f.p.size() != 0) {
         boolean var2 = false;
         ArrayList var3 = this.f.p;

         int var4;
         zpf var5;
         for(var4 = 0; var4 < var3.size(); ++var4) {
            var5 = (zpf)var3.get(var4);
            if (!var5.a()) {
               var2 = true;
            }
         }

         if (!var2) {
            var1.d("<mc:AlternateContent xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\">");
            var1.d("<mc:Choice Requires=\"x14\">");
         }

         var1.b("controls");

         for(var4 = 0; var4 < var3.size(); ++var4) {
            var5 = (zpf)var3.get(var4);
            var1.d("<mc:AlternateContent xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\">");
            var1.d("<mc:Choice Requires=\"x14\">");
            this.a(var1, var5, true, var5.b);
            var1.d("</mc:Choice>");
            if (!var5.a()) {
               var1.d("<mc:Fallback>");
               this.a(var1, var5, false, var5.b);
               var1.d("</mc:Fallback>");
            }

            var1.d("</mc:AlternateContent>");
         }

         var1.b();
         if (!var2) {
            var1.d("</mc:Choice>");
            var1.d("</mc:AlternateContent>");
         }

      }
   }

   private void a(zcfx var1, zpf var2, boolean var3, String var4) throws Exception {
      var1.b("control");
      var1.a("shapeId", var4);
      var1.a("r:id", (String)null, var2.h);
      var1.a("name", var2.a);
      if (var3) {
         var1.b("controlPr");
         var1.a("defaultSize", "0");
         var1.a("autoLine", "0");
         if (var2.f == null) {
            var1.a("autoPict", "0");
         } else {
            var1.a("r:id", var2.f);
         }

         String var5 = var2.k.v();
         if (var5 != null) {
            var1.a("macro", var5);
         }

         this.a(var1, var2.k);
         var1.b();
      }

      var1.b();
   }

   private void a(zcfx var1, Shape var2) throws Exception {
      var1.b("anchor");
      if (var2.getPlacement() == 1) {
         var1.a("moveWithCells", "1");
      } else if (var2.getPlacement() == 2) {
         var1.a("moveWithCells", "1");
         var1.a("sizeWithCells", "1");
      }

      ztn.a(var1, var2, true);
      var1.b();
   }

   private void l(zcfx var1) throws Exception {
      zpr var2 = this.c.g;
      if (var2 != null && (var2.l.size() != 0 || var2.k.size() != 0)) {
         var1.d("<mc:AlternateContent xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\">");
         var1.d("<mc:Choice Requires=\"x14\">");
         Iterator var3 = var2.k.iterator();

         while(var3.hasNext()) {
            String var4 = (String)var3.next();
            var1.d(var4);
         }

         var1.d("</mc:Choice>");
         ArrayList var5 = var2.l;

         for(int var6 = 0; var6 < var5.size(); ++var6) {
            var1.d((String)var5.get(var6));
         }

         var1.d("</mc:AlternateContent>");
      }
   }

   private void m(zcfx var1) throws Exception {
      ProtectedRangeCollection var2 = this.c.getAllowEditRanges();
      if (var2.getCount() != 0) {
         var1.b("protectedRanges");
         Iterator var3 = var2.iterator();

         while(var3.hasNext()) {
            ProtectedRange var4 = (ProtectedRange)var3.next();
            if (var4.a() != null && var4.a().size() != 0) {
               var1.b("protectedRange");
               if ((var4.b() & '\uffff') != 0) {
                  var1.a("password", com.aspose.cells.a.c.zp.d(var4.b() & '\uffff'));
               }

               String var5 = zase.b(var4.a(), 0, var4.a().size());
               var1.a("sqref", var5);
               var1.a("name", var4.getName());
               if (var4.getSecurityDescriptor() != null) {
                  var1.a("securityDescriptor", var4.getSecurityDescriptor());
               }

               var1.b();
            }
         }

         var1.b();
      }
   }

   private void n(zcfx var1) throws Exception {
      Protection var2 = this.c.a();
      if (var2 != null) {
         var1.b("sheetProtection");
         if (var2.a != null) {
            zavu var3 = var2.a;
            if (var3.a == null) {
               if (var3.a() != 0) {
                  var1.a("password", com.aspose.cells.a.c.zp.d(var3.a()));
               }
            } else {
               var1.a("algorithmName", var3.a);
               var1.a("hashValue", com.aspose.cells.b.a.ze.a(var3.b));
               var1.a("saltValue", com.aspose.cells.b.a.ze.a(var3.c));
               var1.a("spinCount", zase.y(var3.d));
            }
         }

         if (!var2.getAllowEditingContent()) {
            var1.a("sheet", "1");
         }

         if (!var2.getAllowEditingObject()) {
            var1.a("objects", "1");
         }

         if (!var2.getAllowEditingScenario()) {
            var1.a("scenarios", "1");
         }

         if (var2.getAllowFormattingCell()) {
            var1.a("formatCells", "0");
         }

         if (var2.getAllowFormattingColumn()) {
            var1.a("formatColumns", "0");
         }

         if (var2.getAllowFormattingRow()) {
            var1.a("formatRows", "0");
         }

         if (var2.getAllowInsertingColumn()) {
            var1.a("insertColumns", "0");
         }

         if (var2.getAllowInsertingRow()) {
            var1.a("insertRows", "0");
         }

         if (var2.getAllowInsertingHyperlink()) {
            var1.a("insertHyperlinks", "0");
         }

         if (var2.getAllowDeletingColumn()) {
            var1.a("deleteColumns", "0");
         }

         if (var2.getAllowDeletingRow()) {
            var1.a("deleteRows", "0");
         }

         if (!var2.getAllowSelectingLockedCell()) {
            var1.a("selectLockedCells", "1");
         }

         if (var2.getAllowSorting()) {
            var1.a("sort", "0");
         }

         if (var2.getAllowFiltering()) {
            var1.a("autoFilter", "0");
         }

         if (var2.getAllowUsingPivotTable()) {
            var1.a("pivotTables", "0");
         }

         if (!var2.getAllowSelectingUnlockedCell()) {
            var1.a("selectUnlockedCells", "1");
         }

         var1.b();
      }
   }

   static void a(zcfx var0, DataSorter var1) throws Exception {
      var0.b("sortState");
      if (var1.getCaseSensitive()) {
         var0.a("caseSensitive", "1");
      }

      if (var1.getSortLeftToRight()) {
         var0.a("columnSort", "1");
      }

      CellArea var2 = var1.b();
      var0.a("ref", zase.a(var2));
      if (var1.b != null && !"".equals(var1.b)) {
         var0.a("sortMethod", var1.b);
      }

      zql var4;
      CellArea var5;
      for(Iterator var3 = var1.a().iterator(); var3.hasNext(); a(var0, var4, var5)) {
         var4 = (zql)var3.next();
         var5 = new CellArea();
         if (var1.getSortLeftToRight()) {
            var5.StartRow = var4.c();
            var5.EndRow = var4.c();
            var5.StartColumn = var2.StartColumn;
            var5.EndColumn = var2.EndColumn;
         } else {
            var5.StartRow = var2.StartRow;
            var5.EndRow = var2.EndRow;
            var5.StartColumn = var4.c();
            var5.EndColumn = var4.c();
         }
      }

      var0.b();
   }

   private static void a(zcfx var0, zql var1, CellArea var2) throws Exception {
      var0.b("sortCondition");
      if (var1.b() == 1) {
         var0.a("descending", "1");
      }

      switch(var1.d()) {
      case 0:
         if (var1.g() != null && !"".equals(var1.g())) {
            var0.a("customList", var1.g());
         } else {
            var0.a("sortBy", "value");
         }
         break;
      case 1:
         var0.a("sortBy", "cellColor");
         if (var1.e() != -1) {
            var0.a("dxfId", zase.y(var1.e()));
         }
         break;
      case 2:
         var0.a("sortBy", "fontColor");
         if (var1.e() != -1) {
            var0.a("dxfId", zase.y(var1.e()));
         }
         break;
      case 3:
         var0.a("sortBy", "icon");
         var0.a("iconSet", zase.R(var1.h()));
         if (var1.i() != -1) {
            var0.a("iconId", zase.y(var1.i()));
         }
      }

      var0.a("ref", zase.a(var2));
      var0.b();
   }

   static void a(zcfx var0, AutoFilter var1, boolean var2) throws Exception {
      var0.b("autoFilter");
      var0.a("ref", var1.getRange());
      var1.c();
      FilterColumnCollection var3 = var1.e;
      if (var3 != null && var3.getCount() > 0) {
         for(int var4 = 0; var4 < var3.getCount(); ++var4) {
            FilterColumn var5 = var3.getByIndex(var4);
            a(var0, var5);
         }
      }

      if (var2 && var1.b != null && var1.b.a().size() > 0) {
         a(var0, var1.b);
      }

      var0.b();
   }

   private static void a(zcfx var0, FilterColumn var1) throws Exception {
      var0.b("filterColumn");
      var0.a("colId", zase.y(var1.getFieldIndex()));
      if (var1.a()) {
         var0.a("hiddenButton", "1");
      }

      if (!var1.b()) {
         var0.a("showButton", "0");
      }

      if (var1.getFilterType() == 6) {
         var0.b();
      } else {
         int var3;
         switch(var1.getFilterType()) {
         case 0:
            ColorFilter var10 = (ColorFilter)var1.getFilter();
            var0.b("colorFilter");
            var0.a("dxfId", zase.y(var10.a()));
            var0.a("cellColor", var10.getFilterByFillColor() ? "1" : "0");
            var0.b();
            break;
         case 1:
            CustomFilterCollection var9 = (CustomFilterCollection)var1.getFilter();
            var0.b("customFilters");
            if (var9.getAnd() && var9.getCount() > 1) {
               var0.a("and", "1");
            }

            for(var3 = 0; var3 < var9.getCount(); ++var3) {
               CustomFilter var11 = var9.get(var3);
               var0.b("customFilter");
               var0.a("operator", zase.ak(var11.getFilterOperatorType()));
               if (var11.getCriteria() != null) {
                  var0.a("val", AutoFilter.b(var11.getCriteria()));
               } else {
                  var0.a("val", " ");
               }

               var0.b();
            }

            var0.b();
            break;
         case 2:
            DynamicFilter var8 = (DynamicFilter)var1.getFilter();
            var0.b("dynamicFilter");
            var0.a("type", zase.ag(var8.getDynamicFilterType()));
            if (var8.getValue() != null) {
               var0.a("val", AutoFilter.b(var8.getValue()));
            }

            if (var8.getMaxValue() != null) {
               var0.a("maxVal", AutoFilter.b(var8.getMaxValue()));
            }

            var0.b();
            break;
         case 3:
            MultipleFilterCollection var7 = (MultipleFilterCollection)var1.getFilter();
            var0.b("filters");
            if (var7.getMatchBlank()) {
               var0.a("blank", "1");
            }

            if (var7.b != null) {
               var0.a("calendarType", var7.b);
            }

            for(var3 = 0; var3 < var7.getCount(); ++var3) {
               Object var4 = var7.get(var3);
               if (var4 instanceof DateTimeGroupItem) {
                  DateTimeGroupItem var5 = (DateTimeGroupItem)var4;
                  var0.b("dateGroupItem");
                  var0.a("dateTimeGrouping", zase.ah(var5.getDateTimeGroupingType()));
                  switch(var5.getDateTimeGroupingType()) {
                  case 0:
                     var0.a("year", zase.y(var5.getYear()));
                     var0.a("month", zase.y(var5.getMonth()));
                     var0.a("day", zase.y(var5.getDay()));
                     break;
                  case 1:
                     var0.a("year", zase.y(var5.getYear()));
                     var0.a("month", zase.y(var5.getMonth()));
                     var0.a("day", zase.y(var5.getDay()));
                     var0.a("hour", zase.y(var5.getHour()));
                     break;
                  case 2:
                     var0.a("year", zase.y(var5.getYear()));
                     var0.a("month", zase.y(var5.getMonth()));
                     var0.a("day", zase.y(var5.getDay()));
                     var0.a("hour", zase.y(var5.getHour()));
                     var0.a("minute", zase.y(var5.getMinute()));
                     break;
                  case 3:
                     var0.a("year", zase.y(var5.getYear()));
                     var0.a("month", zase.y(var5.getMonth()));
                     break;
                  case 4:
                     var0.a("year", zase.y(var5.getYear()));
                     var0.a("month", zase.y(var5.getMonth()));
                     var0.a("day", zase.y(var5.getDay()));
                     var0.a("hour", zase.y(var5.getHour()));
                     var0.a("minute", zase.y(var5.getMinute()));
                     var0.a("second", zase.y(var5.getSecond()));
                     break;
                  case 5:
                     var0.a("year", zase.y(var5.getYear()));
                  }

                  var0.b();
               } else {
                  var0.b("filter");
                  var0.a("val", AutoFilter.b(var4));
                  var0.b();
               }
            }

            var0.b();
            break;
         case 4:
            IconFilter var6 = (IconFilter)var1.getFilter();
            var0.b("iconFilter");
            if (var6.getIconId() != -1) {
               var0.a("iconId", zase.y(var6.getIconId()));
            }

            var0.a("iconSet", zase.R(var6.getIconSetType()));
            var0.b();
            break;
         case 5:
            Top10Filter var2 = (Top10Filter)var1.getFilter();
            var0.b("top10");
            if (!var2.isTop()) {
               var0.a("top", "0");
            }

            if (var2.isPercent()) {
               var0.a("percent", "1");
            }

            var0.a("val", zase.y(var2.getItems()));
            if (var2.getCriteria() != null) {
               var0.a("filterVal", AutoFilter.b(var2.getCriteria()));
            }

            var0.b();
         }

         var0.b();
      }
   }

   private void o(zcfx var1) throws Exception {
      String var2 = null;
      if (this.c.k != null) {
         var2 = this.c.k;
         int var3 = var2.length();
         if (var3 > 0 && Character.isDigit(var2.charAt(0))) {
            byte var4 = 9;
            if (var3 + var4 > 31) {
               var2 = var2.substring(0, 0 + (31 - var4));
            }
         } else if (var3 > 31) {
            var2 = var2.substring(0, 31);
         }
      }

      boolean var7 = false;
      if (!this.c.getOutline().SummaryColumnRight || !this.c.getOutline().SummaryRowBelow) {
         var7 = true;
      }

      String var8 = null;
      if (this.c.g != null) {
         var8 = this.c.g.e;
      }

      String var5 = null;
      if (this.c.getTransitionEvaluation()) {
         var5 = "1";
      }

      String var6 = null;
      if (this.c.getTransitionEntry()) {
         var6 = "1";
      }

      if (!this.c.getPageSetup().isPercentScale() || var2 != null || !this.c.j.a() || var7 || var8 != null || var5 != null || var6 != null) {
         var1.b("sheetPr");
         if (var8 != null) {
            var1.a("published", var8);
         }

         if (var2 != null) {
            var1.a("codeName", var2);
         }

         if (var5 != null) {
            var1.a("transitionEvaluation", var5);
         }

         if (var6 != null) {
            var1.a("transitionEntry", var6);
         }

         if (!this.c.j.a()) {
            zty.a(var1, this.c.j, "tabColor");
         }

         if (var7) {
            var1.b("outlinePr");
            if (!this.c.getOutline().SummaryRowBelow) {
               var1.a("summaryBelow", "0");
            }

            if (!this.c.getOutline().SummaryColumnRight) {
               var1.a("summaryRight", "0");
            }

            var1.b();
         }

         if (!this.c.getPageSetup().isPercentScale()) {
            var1.b("pageSetUpPr");
            var1.a("fitToPage", "1");
            var1.b();
         }

         var1.b();
      }

   }

   private void p(zcfx var1) throws Exception {
      ArrayList var2 = new ArrayList(this.c.getValidations().getCount());
      Iterator var3 = this.c.getValidations().iterator();

      while(var3.hasNext()) {
         Validation var4 = (Validation)var3.next();
         if (var4.getAreaList().size() > 0) {
            com.aspose.cells.b.a.a.ze.a(var2, (Object)var4);
         }
      }

      int var10 = var2.size();
      if (var10 != 0) {
         byte var11 = 100;
         var1.b("dataValidations");
         int var5 = 0;

         int var6;
         Validation var7;
         for(var6 = 0; var6 < var10; ++var6) {
            var7 = (Validation)var2.get(var6);
            if (var7.getAreaList().size() > var11) {
               var5 += var7.getAreaList().size() / var11;
            }

            ++var5;
         }

         var1.a("count", zase.y(var5));

         for(var6 = 0; var6 < var10; ++var6) {
            var7 = (Validation)var2.get(var6);
            if (var7.getAreaList().size() <= var11) {
               this.a(var7, 0, var7.getAreaList().size(), var1);
            } else {
               int var8 = var7.getAreaList().size() / var11;

               for(int var9 = 0; var9 < var8; ++var9) {
                  this.a(var7, var9 * var11, (var9 + 1) * var11, var1);
               }

               this.a(var7, var8 * var11, var7.getAreaList().size(), var1);
            }
         }

         var1.b();
      }
   }

   private void a(Validation var1, int var2, int var3, zcfx var4) throws Exception {
      if (var2 < var3) {
         var4.b("dataValidation");
         if (var1.getAlertStyle() != 1) {
            if (var1.getAlertStyle() == 0) {
               var4.a("errorStyle", "information");
            } else if (var1.getAlertStyle() == 2) {
               var4.a("errorStyle", "warning");
            }
         }

         if (var1.getType() != 0) {
            var4.a("type", zase.e(var1.getType()));
         }

         String var5;
         if (var1.getOperator() != 0 && var1.getOperator() != 6) {
            var5 = zase.f(var1.getOperator());
            var4.a("operator", var5);
         }

         if (var1.getIgnoreBlank()) {
            var4.a("allowBlank", "1");
         }

         if (var1.getType() == 3 && !var1.getInCellDropDown()) {
            var4.a("showDropDown", "1");
         }

         if (var1.getShowInput()) {
            var4.a("showInputMessage", "1");
         }

         if (var1.getShowError()) {
            var4.a("showErrorMessage", "1");
         }

         if (var1.getInputTitle() != null && var1.getInputTitle().length() > 0) {
            var4.a("promptTitle", var1.getInputTitle());
         }

         if (var1.getInputMessage() != null && var1.getInputMessage().length() > 0) {
            var4.a("prompt", var1.getInputMessage());
         }

         if (var1.getErrorTitle() != null && var1.getErrorTitle().length() > 0) {
            var4.a("errorTitle", var1.getErrorTitle());
         }

         if (var1.getErrorMessage() != null && var1.getErrorMessage().length() > 0) {
            var4.a("error", var1.getErrorMessage());
         }

         if (var1.c() != 0) {
            var4.a("imeMode", zase.k(var1.c()));
         }

         var5 = zase.b(var1.getAreaList(), var2, var3);
         var4.a("sqref", var5);
         String var6;
         DateTime var7;
         if (var1.getFormula1() != null && var1.getFormula1().length() > 0) {
            var6 = var1.getFormula1();
            if (var1.getType() == 3) {
               if (var6.charAt(0) == '=') {
                  var6 = var6.substring(1);
               } else if (var6.charAt(0) != '"') {
                  var6 = "\"" + var6 + "\"";
               }
            } else if (var1.getType() != 4 && var1.getType() != 5) {
               var6 = zase.H(var6);
            } else {
               if (var6.charAt(0) == '=') {
                  var6 = var6.substring(1);
               }

               if (!zapb.b(var6)) {
                  try {
                     var7 = DateTime.a(var6);
                     if (var1.getType() == 5) {
                        var6 = zase.b(var7.f().c());
                     } else {
                        var6 = zase.b(CellsHelper.getDoubleFromDateTime(var7, this.b.getSettings().getDate1904()));
                     }
                  } catch (Exception var9) {
                     var6 = zase.H(var6);
                  }
               }
            }

            var4.b("formula1");
            var4.a(zase.a(var6));
            var4.b();
         }

         if ((var1.getOperator() == 0 || var1.getOperator() == 7) && var1.getFormula2() != null && var1.getFormula2().length() > 0) {
            var4.b("formula2");
            var6 = zase.H(var1.getFormula2());
            if ((var1.getType() == 4 || var1.getType() == 5) && !zapb.b(var6)) {
               try {
                  var7 = DateTime.a(var6);
                  if (var1.getType() == 5) {
                     var6 = zase.b(var7.f().c());
                  } else {
                     var6 = zase.b(CellsHelper.getDoubleFromDateTime(var7, this.b.getSettings().getDate1904()));
                  }
               } catch (Exception var8) {
                  var6 = zase.H(var6);
               }
            }

            var4.a(zase.a(var6));
            var4.b();
         }

         var4.b();
      }
   }

   private void a(zcfx var1, PageSetup var2) throws Exception {
      var1.b("pageMargins");
      var1.a("left", zase.b(var2.getLeftMarginInch()));
      var1.a("right", zase.b(var2.getRightMarginInch()));
      var1.a("top", zase.b(var2.getTopMarginInch()));
      var1.a("bottom", zase.b(var2.getBottomMarginInch()));
      var1.a("header", zase.b(var2.getHeaderMarginInch()));
      var1.a("footer", zase.b(var2.getFooterMarginInch()));
      var1.b();
   }

   private void b(zcfx var1, PageSetup var2) throws Exception {
      if (var2.getPrintGridlines() || var2.getPrintHeadings() || var2.getCenterHorizontally() || var2.getCenterVertically()) {
         var1.b("printOptions");
         if (var2.getPrintGridlines()) {
            var1.a("gridLines", "1");
         }

         if (var2.getPrintHeadings()) {
            var1.a("headings", "1");
         }

         if (var2.getCenterHorizontally()) {
            var1.a("horizontalCentered", "1");
         }

         if (var2.getCenterVertically()) {
            var1.a("verticalCentered", "1");
         }

         var1.b();
      }

   }

   private void a(zcfx var1, PageSetup var2, String var3) throws Exception {
      var1.b("pageSetup");
      if (var2.getBlackAndWhite()) {
         var1.a("blackAndWhite", "1");
      }

      if (var2.getPrintComments() != 1) {
         var1.a("cellComments", zase.b(var2.getPrintComments()));
      }

      if (var2.getPrintDraft()) {
         var1.a("draft", "1");
      }

      if (var2.getPrintErrors() != 2) {
         var1.a("errors", zase.c(var2.getPrintErrors()));
      }

      if (!var2.isAutoFirstPageNumber()) {
         var1.a("firstPageNumber", zase.y(var2.getFirstPageNumber()));
         var1.a("useFirstPageNumber", "1");
      }

      if (var2.getFitToPagesTall() != 1) {
         var1.a("fitToHeight", zase.y(var2.getFitToPagesTall()));
      }

      if (var2.getFitToPagesWide() != 1) {
         var1.a("fitToWidth", zase.y(var2.getFitToPagesWide()));
      }

      if (var2.f() > 0 && var2.f() != 600 && !var2.l()) {
         var1.a("horizontalDpi", zase.y(var2.f()));
      }

      if (var2.g() > 0 && var2.g() != 600 && !var2.m()) {
         var1.a("verticalDpi", zase.y(var2.g()));
      }

      var1.a("orientation", zase.a(var2.getOrientation()));
      if (var2.getOrder() != 0) {
         var1.a("pageOrder", zase.d(var2.getOrder()));
      }

      if (!var2.k()) {
         var1.a("paperSize", zase.y(var2.getPaperSize()));
      }

      if (var2.getPrintCopies() > 1) {
         var1.a("copies", zase.y(var2.getPrintCopies()));
      }

      if (var2.getZoom() != 100) {
         if (var2.isPercentScale()) {
            var1.a("scale", zase.y(var2.getZoom()));
         } else {
            var1.a("scale", "10");
         }
      }

      if (var3 != null) {
         var1.a("r:id", var3);
      }

      var1.b();
   }

   private void c(zcfx var1, PageSetup var2) throws Exception {
      String var3 = var2.a(true, 2);
      String var4 = var2.a(false, 2);
      String var5 = var2.a(true, 0);
      String var6 = var2.a(false, 0);
      String var7 = var2.a(true, 1);
      String var8 = var2.a(false, 1);
      if (var3.length() > 0 || var4.length() > 0 || var5.length() > 0 || var6.length() > 0 || var7.length() > 0 || var8.length() > 0 || var2.isHFDiffOddEven() || var2.isHFDiffFirst() || !var2.isHFScaleWithDoc() || !var2.isHFAlignMargins()) {
         var1.b("headerFooter");
         if (var2.isHFDiffOddEven()) {
            var1.a("differentOddEven", "1");
         }

         if (var2.isHFDiffFirst()) {
            var1.a("differentFirst", "1");
         }

         if (!var2.isHFScaleWithDoc()) {
            var1.a("scaleWithDoc", "0");
         }

         if (!var2.isHFAlignMargins()) {
            var1.a("alignWithMargins", "0");
         }

         if (var7.length() > 0) {
            this.a(var1, "oddHeader", var7);
         }

         if (var8.length() > 0) {
            this.a(var1, "oddFooter", var8);
         }

         if (var5.length() > 0) {
            this.a(var1, "evenHeader", var5);
         }

         if (var6.length() > 0) {
            this.a(var1, "evenFooter", var6);
         }

         if (var3.length() > 0) {
            this.a(var1, "firstHeader", var3);
         }

         if (var4.length() > 0) {
            this.a(var1, "firstFooter", var4);
         }

         var1.b();
      }

   }

   private void a(zcfx var1, String var2, String var3) throws Exception {
      var1.b(var2);
      if (var3.startsWith(" ") || var3.endsWith(" ") || var3.startsWith("\n") || var3.endsWith("\n")) {
         var1.a("xml:space", (String)null, "preserve");
      }

      var1.a(var3);
      var1.b();
   }

   private static void a(zcfx var0, HorizontalPageBreakCollection var1) throws Exception {
      if (var1 != null && var1.getCount() > 0) {
         var0.b("rowBreaks");
         int var2 = var1.getCount();
         var0.a("count", zase.y(var2));
         var0.a("manualBreakCount", zase.y(var2));

         for(int var3 = 0; var3 < var2; ++var3) {
            HorizontalPageBreak var4 = var1.get(var3);
            if (var4 != null) {
               var0.b("brk");
               var0.a("id", zase.y(var4.getRow()));
               if (var4.getStartColumn() != 0) {
                  var0.a("min", zase.y(var4.getStartColumn()));
               }

               var0.a("max", zase.y(var4.getEndColumn()));
               var0.a("man", "1");
               var0.b();
            }
         }

         var0.b();
      }

   }

   private static void a(zcfx var0, VerticalPageBreakCollection var1) throws Exception {
      if (var1 != null && var1.getCount() > 0) {
         var0.b("colBreaks");
         int var2 = var1.getCount();
         var0.a("count", zase.y(var2));
         var0.a("manualBreakCount", zase.y(var2));

         for(int var3 = 0; var3 < var2; ++var3) {
            VerticalPageBreak var4 = var1.get(var3);
            if (var4 != null) {
               var0.b("brk");
               var0.a("id", zase.y(var4.getColumn()));
               if (var4.getStartRow() != 0) {
                  var0.a("min", zase.y(var4.getStartRow()));
               }

               var0.a("max", zase.y(var4.getEndRow()));
               var0.a("man", "1");
               var0.b();
            }
         }

         var0.b();
      }

   }

   private void q(zcfx var1) throws Exception {
      var1.b("dimension");
      if (this.d.b((short)0) >= 0 && this.d.d(0) >= 0) {
         String var2 = CellsHelper.columnIndexToName(this.d.getMinColumn()) + (this.d.getMinRow() + 1) + ":" + CellsHelper.columnIndexToName(this.d.b((short)0)) + (this.d.d(0) + 1);
         var1.a("ref", var2);
      } else {
         var1.a("ref", "A1:A1");
      }

      var1.b();
   }

   private void r(zcfx var1) throws Exception {
      var1.b("sheetViews");
      var1.b("sheetView");
      if (this.b.getWorksheets().i != null && this.b.getWorksheets().i.a) {
         var1.a("windowProtection", "1");
      }

      if (this.c.getShowFormulas()) {
         var1.a("showFormulas", "1");
      }

      if (!this.c.isGridlinesVisible()) {
         var1.a("showGridLines", "0");
      }

      if (!this.c.isRowColumnHeadersVisible()) {
         var1.a("showRowColHeaders", "0");
      }

      if (!this.c.getDisplayZeros()) {
         var1.a("showZeros", "0");
      }

      if (this.c.getDisplayRightToLeft()) {
         var1.a("rightToLeft", "1");
      }

      if (this.c.isSelected()) {
         var1.a("tabSelected", "1");
      }

      if (!this.c.isOutlineShown()) {
         var1.a("showOutlineSymbols", "0");
      }

      int var2 = this.c.x();
      if (var2 < 64) {
         var1.a("defaultGridColor", "0");
      }

      String var3 = zase.aq(this.c.getViewType());
      if (var3 != null) {
         var1.a("view", var3);
      }

      if (this.c.getViewType() == 2 && !this.c.isRulerVisible()) {
         var1.a("showRuler", "0");
      }

      if (this.c.getZoom() != 100) {
         var1.a("zoomScale", zase.y(this.c.getZoom()));
      }

      if (this.c.u()[0] != 100) {
         var1.a("zoomScaleNormal", zase.y(this.c.u()[0]));
      }

      if (this.c.u()[1] != 60) {
         var1.a("zoomScaleSheetLayoutView", zase.y(this.c.u()[1]));
      }

      if (this.c.u()[2] != 100) {
         var1.a("zoomScalePageLayoutView", zase.y(this.c.u()[2]));
      }

      if (var2 < 64) {
         var1.a("colorId", zase.y(var2));
      }

      var1.a("workbookViewId", "0");
      String var4 = CellsHelper.columnIndexToName(this.c.getFirstVisibleColumn()) + zase.y(this.c.getFirstVisibleRow() + 1);
      var1.a("topLeftCell", var4);
      zqh var5 = zqh.b(this.c);
      this.a(var1, var5);
      var1.b();
      var1.b();
   }

   private void a(zcfx var1, zqh var2) throws Exception {
      if (var2.a != null) {
         zqi var3 = var2.a;
         var1.b("pane");
         if (var3.b != 0.0D) {
            var1.a("xSplit", zase.b(var3.b));
         }

         if (var3.c != 0.0D) {
            var1.a("ySplit", zase.b(var3.c));
         }

         if (var3.d != null) {
            var1.a("topLeftCell", var3.d);
         }

         if (var3.e != null) {
            var1.a("activePane", var3.e);
         }

         var1.a("state", var3.a);
         var1.b();
      }

      ArrayList var6 = var2.b;

      for(int var4 = 0; var4 < var6.size(); ++var4) {
         zqj var5 = (zqj)var6.get(var4);
         var1.b("selection");
         if (var5.a != null) {
            var1.a("pane", var5.a);
         }

         if (var5.b != null) {
            var1.a("activeCell", var5.b);
         }

         if (var5.c != 0) {
            var1.a("activeCellId", zase.y(var5.c));
         }

         if (var5.d != null && var5.d.length() > 0) {
            var1.a("sqref", var5.d);
         }

         var1.b();
      }

   }

   private void s(zcfx var1) throws Exception {
      if (this.d.q().getCount() != 0) {
         var1.b("mergeCells");
         zani var2 = this.d.q();
         var1.a("count", zase.y(var2.getCount()));
         new ArrayList(var2.getCount());

         for(int var4 = 0; var4 < var2.getCount(); ++var4) {
            CellArea var5 = var2.a(var4);
            var1.b("mergeCell");
            var1.a("ref", zase.a(var5));
            var1.b();
         }

         var1.b();
      }
   }

   private void a(zbbj var1, int var2, int var3, int var4, zcfx var5) throws Exception {
      if (var4 > var3) {
         var5.a("spans", var3 + 1 + ":" + (var4 + 1));
      }

      if (var2 > -1 && this.g.f.containsKey(var2)) {
         String var6 = (String)this.g.f.get(var2);
         var5.a("s", var6);
         var5.a("customFormat", "1");
      }

      double var9 = (double)var1.e / 20.0D;
      var5.a("ht", zase.b(var9));
      if (!var1.c()) {
         var5.a("customHeight", "1");
      }

      if (var1.b()) {
         var5.a("hidden", "1");
      }

      byte var8 = var1.e();
      if (var8 != 0) {
         var5.a("outlineLevel", zase.a(var8));
      }

      if (var1.a()) {
         var5.a("collapsed", "1");
      }

      if (var1.f()) {
         var5.a("thickTop", "1");
      }

      if (var1.g()) {
         var5.a("thickBot", "1");
      }

   }

   private void t(zcfx var1) throws Exception {
      var1.b("sheetData");
      Object var2 = null;
      zgz var3 = null;
      boolean var4 = false;
      if (this.f.e.u != null) {
         var2 = this.f.e.u.a(this.c);
         if (var2 == null) {
            var2 = new zha(this.c);
         } else {
            var4 = true;
            var3 = (zgz)var2;
         }
      } else {
         var2 = new zha(this.c);
      }

      String var5 = null;
      zp var6 = null;
      Row var7 = null;
      zfv var8 = null;
      boolean var9 = true;
      zbbj var12 = new zbbj();

      label284:
      while(true) {
         var6 = ((zafw)var2).c();
         if (var6 == null) {
            var1.b();
            return;
         }

         zbbj var13 = var6.a(var12, 15);
         var7 = null;
         short var25 = -2;
         var5 = zase.y(var6.h() + 1);
         var1.b("row");
         var1.a("r", var5);
         boolean var10;
         int var11;
         if (var13.d()) {
            var11 = var6.i();
            var10 = var11 != 15;
         } else {
            var11 = 15;
            var10 = false;
         }

         if (var4 && var10 && var3.a() == null) {
            var11 = this.f.e.u.b(var11);
         }

         if (!var4 && var6.a() > 0) {
            this.a(var13, var10 ? var11 : -1, var6.a(var6.a(-1, false)), var6.a(var6.a(-1, true)), var1);
         } else {
            this.a(var13, var10 ? var11 : -1, -1, -1, var1);
         }

         while(true) {
            int var14;
            while(true) {
               var8 = ((zafw)var2).d();
               if (var8 == null) {
                  var1.b();
                  continue label284;
               }

               var14 = var8.b;
               if (var8.c != 0) {
                  break;
               }

               if (var14 != -1) {
                  if (var14 != 15 || var10) {
                     break;
                  }

                  int var15 = this.d.d.a(var8.a);
                  if (var15 != -1 && var15 != 15) {
                     break;
                  }
               }
            }

            if (var14 == -1) {
               if (var10) {
                  var14 = var11;
               } else {
                  var14 = this.d.d.a(var8.a);
                  if (var14 < 0) {
                     var14 = 15;
                  }
               }
            }

            var1.b("c");
            if (this.i || var8.a != var25 + 1) {
               var1.a("r", this.a(var5, var8.a));
            }

            String var16;
            if (var14 != -1 && var14 != 15) {
               if (var4 && var3.b() == null) {
                  var14 = this.f.e.u.b(var14);
               }

               Object var26 = this.g.f.get(var14);
               if (var26 != null) {
                  var16 = (String)var26;
                  if (!"0".equals(var16)) {
                     var1.a("s", var16);
                  }
               }
            }

            String var27 = null;
            var16 = null;
            boolean var17 = false;
            boolean var18 = false;
            int var19 = var8.c;
            Object var20 = var8.d;
            switch(var19) {
            case 4:
               var17 = var8.e && ((zayy)var8.d).g();
               var27 = "s";
               zayy var28 = (zayy)var8.d;
               int var22 = var28.e;
               if (var4 && (var22 <= -1 || var22 >= this.f.e.u.d)) {
                  if (this.f.e.u.b.isGatherString()) {
                     var16 = zase.y(this.f.e.u.a(var28.c, true));
                  } else {
                     var27 = "str";
                     var16 = zase.a(var28.c);
                  }
               } else {
                  var16 = zase.y(var22);
               }
               break;
            case 5:
               zyi var21 = (zyi)var8.d;
               if (var21.c != 4) {
                  var19 = var21.c;
                  var20 = var21.d;
               } else {
                  var27 = "str";
                  var16 = zase.a((String)var21.d);
                  var18 = var16 != null && var16.length() > 0 && var16.charAt(0) == ' ';
               }
            }

            switch(var19) {
            case 1:
            case 6:
               var27 = "n";
               var16 = var8.a(true);
               break;
            case 2:
               var27 = "b";
               var16 = (Boolean)var20 ? "1" : "0";
               break;
            case 3:
               var27 = "e";
               var16 = zfv.a(var20);
               if (var16 == null) {
                  var16 = "#VALUE!";
               }
            case 4:
            case 5:
            }

            if (var27 != null && !"n".equals(var27)) {
               var1.a("t", var27);
            }

            if (var17) {
               var1.a("ph", "1");
            }

            if (var8.c == 5) {
               Object var29 = null;
               if (var4) {
                  var29 = var3.b();
               }

               if (var29 == null) {
                  if (var7 == null) {
                     var7 = new Row(this.d, this.e, var6, false);
                  }

                  var29 = new Cell(var7, var6.b(var8.a), var8, !var6.e());
               }

               zyi var30 = (zyi)var8.d;
               if (var30.e()) {
                  if (var30.l()) {
                     this.a(var1, (Cell)var29, false, -1);
                  }
               } else if (var30.b(this.d)) {
                  if (var30.m()) {
                     int var23 = com.aspose.cells.b.a.a.ze.a(this.j, (Object)this.a(var6.h(), var8.a));
                     this.a(var1, (Cell)var29, true, var23);
                  } else {
                     Cell var31 = ((Cell)var29).B();
                     int var24 = this.j.indexOf(this.a(var31.getRow(), var31.getColumn()));
                     if (var24 != -1) {
                        var1.b("f");
                        if (((Cell)var29).b(var31)) {
                           var1.a("ca", "1");
                        }

                        var1.a("t", "shared");
                        var1.a("si", zase.y(var24));
                        var1.b();
                     }
                  }
               } else {
                  String var34;
                  if (((Cell)var29).A()) {
                     zaaz var32 = ((Cell)var29).E();
                     if (var32 != null) {
                        var1.b("f");
                        var34 = zase.a(var32.a);
                        var1.a("t", "dataTable");
                        var1.a("ref", var34);
                        var1.a("dt2D", var32.d() ? "1" : "0");
                        var1.a("dtr", var32.e() ? "1" : "0");
                        if (var32.d()) {
                           var1.a("r1", var32.g());
                           var1.a("r2", var32.h());
                        } else if (var32.e()) {
                           var1.a("r1", var32.g());
                        } else {
                           var1.a("r1", var32.h());
                        }

                        if (var32.b()) {
                           var1.a("del1", "1");
                        }

                        if (var32.c()) {
                           var1.a("del2", "1");
                        }

                        var1.b();
                     }
                  } else {
                     String var33 = ((Cell)var29).u();
                     if (var33 != null && var33.length() > 0) {
                        var1.b("f");
                        if (((Cell)var29).b((Cell)null)) {
                           var1.a("ca", "1");
                        }

                        var34 = zase.H(var33);
                        var1.a(var34);
                        var1.b();
                     }
                  }
               }
            }

            if (var16 != null) {
               if (var16.length() > 0) {
                  var1.b("v");
                  if (var18) {
                     var1.a("xml:space", "preserve");
                  }

                  var1.a(var16);
                  var1.b();
               } else {
                  var1.b("v", (String)null);
               }
            }

            var1.b();
            var25 = var8.a;
         }
      }
   }

   private long a(int var1, int var2) {
      return (long)var1 << 16 | (long)var2;
   }

   private void a(zcfx var1, Cell var2, boolean var3, int var4) throws Exception {
      String var5 = var2.u();
      var1.b("f");
      if (var2.b((Cell)null)) {
         var1.a("ca", "1");
      }

      if (var3) {
         var1.a("t", "shared");
         var1.a("si", zase.y(var4));
      } else {
         var1.a("t", "array");
      }

      String var6 = zase.a(var2.D().a());
      var1.a("ref", var6);
      String var7 = zase.H(var5);
      var1.a(var7);
      var1.b();
   }

   private String a(String var1, int var2) {
      Object var4 = this.h.get(var2);
      String var3;
      if (var4 != null) {
         var3 = (String)var4;
      } else {
         var3 = CellsHelper.columnIndexToName(var2);
         this.h.put(var2, var3);
      }

      return var3 + var1;
   }

   private void u(zcfx var1) throws Exception {
      var1.b("sheetFormatPr");
      double var2 = 0.0D;
      if (this.d.getColumns().b() != 0.0D) {
         var2 = this.d.getColumns().b() + 5.0D / (double)this.b.getWorksheets().I();
      }

      var1.a("defaultColWidth", zase.b(var2));
      var1.a("defaultRowHeight", zase.b(this.d.getStandardHeight()));
      if (this.f.e.b.f != null && this.f.e.b.f[this.c.getIndex()]) {
         var1.a("thickTop", "1");
      }

      if (this.f.e.b.g != null && this.f.e.b.g[this.c.getIndex()]) {
         var1.a("thickBottom", "1");
      }

      if (!this.d.isDefaultRowHeightMatched()) {
         var1.a("customHeight", "1");
      }

      if (this.d.t()) {
         var1.a("zeroHeight", "1");
      }

      if (this.d.v() != 0) {
         var1.a("outlineLevelRow", zase.a(this.d.v()));
      }

      if (this.d.u() != 0) {
         var1.a("outlineLevelCol", zase.a(this.d.u()));
      }

      var1.b();
   }

   private void v(zcfx var1) throws Exception {
      ColumnCollection var2 = this.d.getColumns();
      if (var2.getCount() != 0 || var2.b != null && var2.b.j()) {
         var1.b("cols");
         Column var3 = var2.b;
         int var4 = 16383;
         if (var3 != null) {
            if (var3.j()) {
               Column var5 = new Column(var3.getIndex(), this.c, var2.b(), var3);
               var3 = var5;
               var4 = var5.getIndex();
            } else {
               var3 = null;
            }
         }

         int var11 = 0;

         for(int var6 = 0; var6 < var2.getCount(); ++var6) {
            Column var7 = var2.getColumnByIndex(var6);
            if (var7.getIndex() - var11 != 0 && var3 != null && var7.getIndex() > var4) {
               if (var11 < var4) {
                  var11 = var4;
               }

               var3.a(var11);
               this.a(var1, var3, var7.getIndex() - var11 - 1);
            }

            int var8 = var7.c();
            int var9 = 0;
            ++var6;

            while(var6 < var2.getCount()) {
               Column var10 = var2.getColumnByIndex(var6);
               if (var10.getIndex() != var7.getIndex() + var9 + 1 || !var7.b(var10)) {
                  --var6;
                  break;
               }

               ++var9;
               ++var6;
            }

            this.a(var1, var7, var9);
            var11 = var7.getIndex() + var9 + 1;
         }

         if (var3 != null && var11 <= 16383) {
            if (var11 < var4) {
               var11 = var4;
            }

            var3.a(var11);
            this.a(var1, var3, 16383 - var11);
         }

         var1.b();
      }
   }

   private void a(zcfx var1, Column var2, int var3) throws Exception {
      var1.b("col");
      var1.a("min", zase.y(var2.getIndex() + 1));
      String var4 = null;
      int var5 = var2.c();
      if (var5 != 15 && var5 != 4095 && var5 != 0 && this.g.f.containsKey(var5)) {
         var4 = (String)this.g.f.get(var5);
      }

      int var6 = var2.getIndex() + 1 + var3;
      var1.a("max", zase.y(var6));
      double var7 = (double)this.a(var2) / (double)this.b.getWorksheets().I();
      var1.a("width", zase.b(var7));
      if (var4 != null) {
         var1.a("style", var4);
      }

      if (var2.isHidden()) {
         var1.a("hidden", "1");
      } else if (var2.h()) {
         var1.a("bestFit", "1");
      }

      if (!var2.i()) {
         var1.a("customWidth", "1");
      }

      if (var2.b() != 0) {
         var1.a("outlineLevel", zase.a(var2.b()));
      }

      if (var2.g()) {
         var1.a("collapsed", "1");
      }

      var1.b();
   }

   private int a(Column var1) {
      WorksheetCollection var2 = this.b.getWorksheets();
      double var3 = var1.getWidth();
      return zkp.b(var3, var2);
   }

   private void w(zcfx var1) throws Exception {
      if (this.f.f != null && this.f.f.size() != 0) {
         var1.b("hyperlinks");

         for(int var2 = 0; var2 < this.f.f.size(); ++var2) {
            zoa var3 = (zoa)this.f.f.get(var2);
            var1.b("hyperlink");
            var1.a("ref", zase.a(var3.b.getArea()));
            if (var3.a != null && var3.a.length() > 0) {
               var1.a("r:id", (String)null, var3.a);
            }

            if (var3.d == 2) {
               var1.a("location", var3.c);
            }

            if (var3.b.getScreenTip() != null && var3.b.getScreenTip().length() > 0) {
               var1.a("tooltip", var3.b.getScreenTip());
            }

            String var4 = var3.b.getTextToDisplay();
            if (var4 != null && var4.length() > 0) {
               var1.a("display", var4);
            }

            var1.b();
         }

         var1.b();
      }
   }

   private int a() {
      int var1 = 1;

      int var2;
      int var4;
      for(var2 = 0; var2 < this.c.getConditionalFormattings().getCount(); ++var2) {
         FormatConditionCollection var3 = this.c.getConditionalFormattings().get(var2);

         for(var4 = 0; var4 < var3.getCount(); ++var4) {
            ++var1;
         }
      }

      if (this.c.b != null) {
         for(var2 = 0; var2 < this.c.b.getCount(); ++var2) {
            PivotTable var5 = this.c.b.get(var2);
            if (var5.aj != null) {
               for(var4 = 0; var4 < var5.aj.getCount(); ++var4) {
                  ++var1;
               }
            }
         }
      }

      return var1;
   }

   private void x(zcfx var1) throws Exception {
      if (this.c.getConditionalFormattings().getCount() != 0) {
         this.m = this.a();

         for(int var2 = 0; var2 < this.c.getConditionalFormattings().getCount(); ++var2) {
            FormatConditionCollection var3 = this.c.getConditionalFormattings().get(var2);
            if (var3.getCount() != 0 && !var3.a(false)) {
               this.a(var1, var3, false);
            }
         }

      }
   }

   private void a(zcfx var1, FormatConditionCollection var2, boolean var3) throws Exception {
      String var4;
      int var5;
      FormatCondition var6;
      if (!var3) {
         var1.b("conditionalFormatting");
         if (var2.d) {
            var1.a("pivot", "1");
         }

         if (var2.b != null && var2.b.size() > 0) {
            this.l = zase.b(var2.b, 0, var2.b.size());
            var1.a("sqref", this.l);
         }

         var4 = this.a(var2);

         for(var5 = 0; var5 < var2.getCount(); ++var5) {
            var6 = var2.get(var5);
            this.a(var1, var6, var4, this.m, var3);
            --this.m;
         }

         var1.b();
      } else {
         if (var2.b != null && var2.b.size() > 0) {
            this.l = zase.b(var2.b, 0, var2.b.size());
         }

         var1.b("x14:conditionalFormatting");
         var1.a("xmlns:xm", "http://schemas.microsoft.com/office/excel/2006/main");
         if (var2.d) {
            var1.a("pivot", "1");
         }

         var4 = this.a(var2);

         for(var5 = 0; var5 < var2.getCount(); ++var5) {
            var6 = var2.get(var5);
            this.a(var1, var6, var4, this.m, var3);
            --this.m;
         }

         var1.b("xm:sqref");
         var1.a(this.l);
         var1.b();
         var1.b();
      }

   }

   void b(zcfx var1) throws Exception {
      ConditionalFormattingCollection var2 = this.c.getConditionalFormattings();
      if (var2.getCount() != 0) {
         if (var2.b()) {
            var1.b("ext");
            var1.a("uri", "{78C0D931-6437-407d-A8EE-F0AAD7539E65}");
            var1.a("xmlns:x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
            var1.b("x14:conditionalFormattings");
            this.m = this.a();
            Iterator var3 = var2.iterator();

            while(var3.hasNext()) {
               FormatConditionCollection var4 = (FormatConditionCollection)var3.next();
               if (var4.a(true)) {
                  this.a(var1, var4, true);
               }
            }

            var1.b();
            var1.b();
         }
      }
   }

   private String a(FormatCondition var1) {
      String var2 = null;
      if (var1.getType() == 0 && var1.b != 6) {
         var2 = zase.f(var1.b);
      } else if (var1.getType() == 8) {
         var2 = "containsText";
      } else if (var1.getType() == 9) {
         var2 = "notContains";
      } else if (var1.getType() == 10) {
         var2 = "beginsWith";
      } else if (var1.getType() == 11) {
         var2 = "endsWith";
      }

      return var2;
   }

   private String a(FormatConditionCollection var1) {
      int var2 = 16383;
      int var3 = 1048575;

      for(int var4 = 0; var4 < var1.b.size(); ++var4) {
         CellArea var5 = (CellArea)var1.b.get(var4);
         if (var5.StartRow < var3) {
            var3 = var5.StartRow;
         }

         if (var5.EndRow < var3) {
            var3 = var5.EndRow;
         }

         if (var5.EndColumn < var2) {
            var2 = var5.EndColumn;
         }

         if (var5.StartColumn < var2) {
            var2 = var5.StartColumn;
         }
      }

      String var6 = CellsHelper.columnIndexToName(var2);
      String var7 = var6 + zase.y(var3 + 1);
      return var7;
   }

   private void a(zcfx var1, FormatCondition var2, String var3, int var4, boolean var5) throws Exception {
      int var6 = var2.c;
      if (!var5) {
         var1.b("cfRule");
      } else {
         var1.b("x14:cfRule");
      }

      var1.a("type", zase.z(var6));
      String var7 = "{" + var2.b() + "}";
      if (var2.getType() == 3 && var5) {
         var1.a("id", var7);
      } else {
         if (var2.getPriority() == 0) {
            var1.a("priority", zase.y(var4));
         } else {
            var1.a("priority", zase.y(var2.getPriority()));
         }

         if (var5) {
            var1.a("id", var7);
         }
      }

      if (var2.d() != -1 && !var5) {
         var1.a("dxfId", zase.y(var2.d()));
      }

      String var8 = this.a(var2);
      if (var8 != null) {
         var1.a("operator", var8);
      }

      if (var2.getStopIfTrue()) {
         var1.a("stopIfTrue", "1");
      }

      String var10;
      switch(var6) {
      case 5:
         Top10 var11 = var2.getTop10();
         if (var11.getRank() != 0) {
            var1.a("rank", zase.y(var11.getRank()));
         }

         if (var11.isBottom()) {
            var1.a("bottom", "1");
         }

         if (var11.isPercent()) {
            var1.a("percent", "1");
         }
      case 6:
      case 7:
      case 12:
      case 13:
      case 14:
      case 15:
      default:
         break;
      case 8:
      case 9:
      case 10:
      case 11:
         var10 = var2.getText();
         if (var10 == null || var10.length() <= 1 || var10.charAt(0) != '=') {
            var1.a("text", var10);
         }
         break;
      case 16:
         var10 = zase.V(var2.getTimePeriod());
         var1.a("timePeriod", var10);
         break;
      case 17:
         AboveAverage var9 = var2.getAboveAverage();
         if (!var9.isAboveAverage()) {
            var1.a("aboveAverage", "0");
         }

         if (var9.isEqualAverage()) {
            var1.a("equalAverage", "1");
         }

         if (var9.getStdDev() != 0) {
            var1.a("stdDev", zase.y(var2.getAboveAverage().getStdDev()));
         }
      }

      switch(var6) {
      case 0:
      case 1:
         this.a(var1, var2.getFormula1(), var5);
         if (var2.b == 0 || var2.b == 7) {
            this.a(var1, var2.getFormula2(), var5);
         }
         break;
      case 2:
         this.a(var1, var2);
         break;
      case 3:
         this.b(var1, var2, var5);
         if (!var5) {
            this.a(var1, var2, var7);
         }
         break;
      case 4:
         this.a(var1, var2, var5);
         break;
      default:
         var10 = var2.getFormula1();
         this.a(var1, var10, var5);
         if (var5) {
            switch(var6) {
            case 8:
            case 9:
            case 10:
            case 11:
               var10 = var2.getText();
               this.a(var1, var10, var5);
            }
         }
      }

      if (var5) {
         if (var2.d() != -1) {
            this.a.a(var1, var2.getStyle(), "x14");
         } else {
            var1.b("x14:dxf", "");
         }
      }

      var1.b();
   }

   private void a(zcfx var1, FormatCondition var2, boolean var3) throws Exception {
      IconSet var4 = var2.getIconSet();
      if (!var3) {
         var1.b("iconSet");
      } else {
         var1.b("x14:iconSet");
      }

      if (!var2.getIconSet().isCustom()) {
         var1.a("iconSet", zase.R(var4.getType()));
      } else {
         var1.a("iconSet", zase.R(var4.a));
         var1.a("custom", "1");
      }

      if (!var4.getShowValue()) {
         var1.a("showValue", "0");
      }

      if (var4.getReverse()) {
         var1.a("reverse", "1");
      }

      int var5;
      for(var5 = 0; var5 < var4.getCfvos().getCount(); ++var5) {
         ConditionalFormattingValue var6 = var4.getCfvos().get(var5);
         this.a(var1, var6, var3, false);
      }

      if (var4.isCustom() && var3) {
         for(var5 = 0; var5 < var4.b.getCount(); ++var5) {
            ConditionalFormattingIcon var7 = var4.b.get(var5);
            this.a(var1, var7);
         }
      }

      var1.b();
   }

   private void a(zcfx var1, ConditionalFormattingIcon var2) throws Exception {
      var1.b("x14:cfIcon");
      var1.a("iconSet", zase.R(var2.getType()));
      var1.a("iconId", zase.y(var2.getIndex()));
      var1.b();
   }

   private void a(zcfx var1, ConditionalFormattingValue var2, boolean var3, boolean var4) throws Exception {
      if (!var3) {
         var1.b("cfvo");
      } else {
         var1.b("x14:cfvo");
      }

      if (!var2.isGTE()) {
         var1.a("gte", "0");
      }

      String var5 = zase.S(var2.getType());
      if (!var3) {
         switch(var2.getType()) {
         case 6:
            var5 = "max";
            break;
         case 7:
            var5 = "min";
         }
      }

      var1.a("type", var5);
      String var6 = var2.c();
      if (var4) {
         if (var2.getType() == 6 || var2.getType() == 7 || var2.getType() == 1 || var2.getType() == 2) {
            var1.b();
            return;
         }
      } else if (var2.getType() == 1 || var2.getType() == 2) {
         var6 = "0";
      }

      if (var6 != null) {
         if (!var3) {
            var1.a("val", com.aspose.cells.b.a.zr.a(var6));
         } else {
            var1.b("xm:f");
            var1.a(com.aspose.cells.b.a.zr.a(var6));
            var1.b();
         }
      }

      var1.b();
   }

   private void b(zcfx var1, FormatCondition var2, boolean var3) throws Exception {
      DataBar var4 = var2.getDataBar();
      if (!var3) {
         var1.b("dataBar");
      } else {
         var1.b("x14:dataBar");
      }

      if (var2.getType() == 3 && var3) {
         var1.a("minLength", zase.y(var4.getMinLength()));
         var1.a("maxLength", zase.y(var4.getMaxLength()));
         if (var4.getBarFillType() == 0) {
            var1.a("gradient", "0");
         }

         if (var4.getBarBorder().getType() == 1) {
            var1.a("border", "1");
         }

         if (var4.getDirection() != 0) {
            var1.a("direction", zase.T(var4.getDirection()));
         }

         if (var4.getNegativeBarFormat().getBorderColorType() != 1) {
            var1.a("negativeBarBorderColorSameAsPositive", "0");
         }

         if (var4.getNegativeBarFormat().getColorType() == 1) {
            var1.a("negativeBarColorSameAsPositive", "1");
         }

         if (var4.getAxisPosition() != 0) {
            var1.a("axisPosition", zase.U(var4.getAxisPosition()));
         }
      } else {
         if (var4.getMinLength() != 10) {
            var1.a("minLength", zase.y(var4.getMinLength()));
         }

         if (var4.getMaxLength() != 90) {
            var1.a("maxLength", zase.y(var4.getMaxLength()));
         }
      }

      if (!var4.getShowValue()) {
         var1.a("showValue", "0");
      }

      this.a(var1, var4.getMinCfvo(), var3, true);
      this.a(var1, var4.getMaxCfvo(), var3, true);
      if (!var3) {
         zty.a(var1, var4.b(), "color");
      } else {
         if (var4.getBarBorder().getType() == 1) {
            zty.a(var1, var4.getBarBorder().a(), "x14:borderColor");
         }

         if (var4.getNegativeBarFormat().getColorType() == 0) {
            zty.a(var1, var4.getNegativeBarFormat().b(), "x14:negativeFillColor");
         }

         if (var4.getBarBorder().getType() == 1 && var4.getNegativeBarFormat().getBorderColorType() != 1) {
            zty.a(var1, var4.getNegativeBarFormat().a(), "x14:negativeBorderColor");
         }

         zty.a(var1, var4.a(), "x14:axisColor");
      }

      var1.b();
   }

   private void a(zcfx var1, FormatCondition var2) throws Exception {
      ColorScale var3 = var2.getColorScale();
      var1.b("colorScale");
      this.a(var1, var3.a, false, false);
      if (var3.a()) {
         this.a(var1, var3.b, false, false);
      }

      this.a(var1, var3.c, false, false);
      zty.a(var1, var3.b(), "color");
      if (var3.b != null) {
         zty.a(var1, var3.c(), "color");
      }

      zty.a(var1, var3.d(), "color");
      var1.b();
   }

   private void a(zcfx var1, String var2, boolean var3) throws Exception {
      if (var3) {
         var1.b("xm:f");
      } else {
         var1.b("formula");
      }

      var1.a(this.a(var2));
      var1.b();
   }

   private String a(String var1) {
      if (var1 == null) {
         return "";
      } else if (var1.length() == 0) {
         return "\"\"";
      } else if (var1.charAt(0) == '=') {
         return var1.length() == 1 ? "\"=\"" : var1.substring(1);
      } else {
         return zapb.b(var1) ? var1 : "\"" + var1 + "\"";
      }
   }

   private void a(zcfx var1, FormatCondition var2, String var3) throws Exception {
      var1.b("extLst");
      var1.b("ext");
      var1.a("uri", "{B025F937-C7B1-47D3-B67F-A62EFF666E3E}");
      var1.a("xmlns:x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
      var1.b("x14:id");
      var1.a(var3);
      var1.b();
      var1.b();
      var1.b();
   }
}
